home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Freeware / Programare / bluej / bluejsetup-200.exe / {app} / examples / people / Staff.java < prev    next >
Encoding:
Text File  |  2004-09-15  |  1.1 KB  |  57 lines

  1. /**
  2.  * A class representing staff members for a simple BlueJ demo program.
  3.  *
  4.  * @author  Michael Kolling
  5.  * @version 1.0, January 1999
  6.  */
  7. class Staff extends Person
  8. {
  9.     private String room;
  10.  
  11.     /**
  12.      * Create a staff member with default settings for detail information.
  13.      */
  14.     Staff()
  15.     {
  16.         super("(unknown name)", 0000);
  17.         room = "(unknown room)";
  18.     }
  19.  
  20.     /**
  21.      * Create a staff member with given name, year of birth and room
  22.      * number.
  23.      */
  24.     Staff(String name, int yearOfBirth, String roomNumber)
  25.     {
  26.         super(name, yearOfBirth);
  27.         room = roomNumber;
  28.     }
  29.  
  30.     /**
  31.      * Set a new room number for this person.
  32.      */
  33.     public void setRoom(String newRoom)
  34.     {
  35.         room = newRoom;
  36.     }
  37.  
  38.     /**
  39.      * Return the room number of this person.
  40.      */
  41.     public String getRoom()
  42.     {
  43.         return room;
  44.     }
  45.  
  46.     /**
  47.      * Return a string representation of this object.
  48.      */
  49.     public String toString()    // redefined from "Person"
  50.     {
  51.         return super.toString() +
  52.                "Staff member\n" +
  53.                "Room: " + room + "\n";
  54.     }
  55. }
  56.  
  57.